﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace MT.ControlLibrary.Controls
{
    public class TabItemWithImage:TabItem
    {
        /// <summary>
        /// Icon 按钮的Content，使用IconFont的形式
        /// </summary>
        public static readonly DependencyProperty SpaceMarkVisibilityProperty = DependencyProperty.Register("SpaceMarkVisibility", typeof(Visibility), typeof(TabItemWithImage), new PropertyMetadata(Visibility.Visible));
        public Visibility SpaceMarkVisibility
        {
            get { return (Visibility)GetValue(SpaceMarkVisibilityProperty); }
            set { SetValue(SpaceMarkVisibilityProperty, value); }
        }

        /// <summary>
        /// Icon 按钮的Content，使用IconFont的形式
        /// </summary>
        public static readonly DependencyProperty IconVisibilityProperty = DependencyProperty.Register("IconVisibility", typeof(Visibility), typeof(TabItemWithImage), new PropertyMetadata(Visibility.Visible));
        public Visibility IconVisibility
        {
            get { return (Visibility)GetValue(IconVisibilityProperty); }
            set { SetValue(IconVisibilityProperty, value); }
        }

        //定义图标依赖属性
        public ImageSource HeaderIcon
        {
            get { return (ImageSource)GetValue(HeaderIconProperty); }
            set { SetValue(HeaderIconProperty, value); }
        }

        public static readonly DependencyProperty HeaderIconProperty = DependencyProperty.Register("HeaderIcon", typeof(ImageSource), typeof(TabItemWithImage), new PropertyMetadata(null, OnPropertyChanged));

        static TabItemWithImage()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TabItemWithImage), new FrameworkPropertyMetadata(typeof(TabItemWithImage)));            
        }

        private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            d.SetValue(e.Property, e.NewValue);
        }
    }
}
